<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>x-template</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

</head>
<body>
    <div id="app">
        <p>{{msg}}</p>     
        <my-one> </my-one>
    </div>   

    <!-- 使用script去写子组件的模板，通过id 赋值给子组件的template -->
    <script type="text/x-template" id="one">
        <div style="border:1px solid red">
            <p>{{msg}}</p>
        </div>
    </script>
    <script>
        
        Vue.component("my-one",{
            template:"#one",
            data(){
                return {
                    msg:"子组件的msg"
                }
            }
           
        });
        var app = new Vue({
            el:"#app",
            data:{
                msg:'父组件的msg',
            },         
        })
    </script>
    
</body>
</html>